/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gnote;

import gnote.Regla;
import java.util.Enumeration;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import org.netbeans.microedition.lcdui.WaitScreen;
import org.netbeans.microedition.util.SimpleCancellableTask;
import java.util.Hashtable;
/**
 * @author fede
 */
public class GameNote extends MIDlet implements CommandListener {

    private boolean midletPaused = false;
    private Hashtable juegos = new Hashtable();
    private Juego juegoActual = null;
    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private WaitScreen waitScreen;
    private List guiOpciones;
    private List guiJugador;
    private List guiJuego;
    private List guiRegla;
    private TextBox guiEditCantidadVidas;
    private TextBox guiEditNombreJugador;
    private TextBox guiEditPuntajeInicial;
    private TextBox guiEditPuntaje;
    private TextBox guiEditNombreRegla;
    private List guiPartida;
    private List guiListaJuegos;
    private TextBox guiEditNombreJuego;
    private List guiListaReglas;
    private Command exitCommand1;
    private Command backCommand1;
    private Command cancelCommand;
    private Command backCommand3;
    private Command backCommand6;
    private Command backCommand5;
    private Command backCommand4;
    private Command backCommand7;
    private Command okCommand12;
    private Command okCommand13;
    private Command okCommand9;
    private Command okCommand10;
    private Command okCommand11;
    private Command backCommand8;
    private Command okCommand14;
    private Command backCommand9;
    private Command backCommand10;
    private Command okCommand;
    private Command backCommand;
    private Command okCommand1;
    private Command cancelCommand1;
    private Command okCommand2;
    private Command eliminarReglaCommand;
    private Command editarReglaCommand;
    private SimpleCancellableTask task;
    private Image image1;
    //</editor-fold>//GEN-END:|fields|0|

    /**
     * The GameNote constructor.
     */
    public GameNote() {
    }

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">//GEN-BEGIN:|0-initialize|0|0-preInitialize
    /**
     * Initilizes the application.
     * It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.
     */
    private void initialize() {//GEN-END:|0-initialize|0|0-preInitialize
        // write pre-initialize user code here
//GEN-LINE:|0-initialize|1|0-postInitialize
        // write post-initialize user code here
    }//GEN-BEGIN:|0-initialize|2|
    //</editor-fold>//GEN-END:|0-initialize|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">//GEN-BEGIN:|3-startMIDlet|0|3-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Started point.
     */
    public void startMIDlet() {//GEN-END:|3-startMIDlet|0|3-preAction
        // write pre-action user code here
        switchDisplayable(null, getWaitScreen());//GEN-LINE:|3-startMIDlet|1|3-postAction
        // write post-action user code here
    }//GEN-BEGIN:|3-startMIDlet|2|
    //</editor-fold>//GEN-END:|3-startMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">//GEN-BEGIN:|4-resumeMIDlet|0|4-preAction
    /**
     * Performs an action assigned to the Mobile Device - MIDlet Resumed point.
     */
    public void resumeMIDlet() {//GEN-END:|4-resumeMIDlet|0|4-preAction
        // write pre-action user code here
//GEN-LINE:|4-resumeMIDlet|1|4-postAction
        // write post-action user code here
    }//GEN-BEGIN:|4-resumeMIDlet|2|
    //</editor-fold>//GEN-END:|4-resumeMIDlet|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">//GEN-BEGIN:|5-switchDisplayable|0|5-preSwitch
    /**
     * Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.
     * @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately
     * @param nextDisplayable the Displayable to be set
     */
    public void switchDisplayable(Alert alert, Displayable nextDisplayable) {//GEN-END:|5-switchDisplayable|0|5-preSwitch
        // write pre-switch user code here
        Display display = getDisplay();//GEN-BEGIN:|5-switchDisplayable|1|5-postSwitch
        if (alert == null) {
            display.setCurrent(nextDisplayable);
        } else {
            display.setCurrent(alert, nextDisplayable);
        }//GEN-END:|5-switchDisplayable|1|5-postSwitch
        // write post-switch user code here
    }//GEN-BEGIN:|5-switchDisplayable|2|
    //</editor-fold>//GEN-END:|5-switchDisplayable|2|







    //<editor-fold defaultstate="collapsed" desc=" Generated Method: commandAction for Displayables ">//GEN-BEGIN:|7-commandAction|0|7-preCommandAction
    /**
     * Called by a system to indicated that a command has been invoked on a particular displayable.
     * @param command the Command that was invoked
     * @param displayable the Displayable where the command was invoked
     */
    public void commandAction(Command command, Displayable displayable) {//GEN-END:|7-commandAction|0|7-preCommandAction
        // write pre-action user code here
        if (displayable == guiEditCantidadVidas) {//GEN-BEGIN:|7-commandAction|1|128-preAction
            if (command == backCommand6) {//GEN-END:|7-commandAction|1|128-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJugador());//GEN-LINE:|7-commandAction|2|128-postAction
                // write post-action user code here
            } else if (command == okCommand12) {//GEN-LINE:|7-commandAction|3|154-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJugador());//GEN-LINE:|7-commandAction|4|154-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|5|184-preAction
        } else if (displayable == guiEditNombreJuego) {
            if (command == backCommand10) {//GEN-END:|7-commandAction|5|184-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJuego());//GEN-LINE:|7-commandAction|6|184-postAction
                // write post-action user code here
            } else if (command == okCommand14) {//GEN-LINE:|7-commandAction|7|186-preAction
                // write pre-action user code here
                // OJO COMPROBAR QUE EL NOMBRE NO SEA NULO
                System.out.println("Editando Nombre de Juego: OJO COMPROBAR QUE EL NOMBRE NO SEA NULO");
                switchDisplayable(null, getGuiJuego());//GEN-LINE:|7-commandAction|8|186-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|9|122-preAction
        } else if (displayable == guiEditNombreJugador) {
            if (command == backCommand4) {//GEN-END:|7-commandAction|9|122-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJugador());//GEN-LINE:|7-commandAction|10|122-postAction
                // write post-action user code here
            } else if (command == okCommand11) {//GEN-LINE:|7-commandAction|11|151-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJugador());//GEN-LINE:|7-commandAction|12|151-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|13|126-preAction
        } else if (displayable == guiEditNombreRegla) {
            if (command == backCommand5) {//GEN-END:|7-commandAction|13|126-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiRegla());//GEN-LINE:|7-commandAction|14|126-postAction
                // write post-action user code here
            } else if (command == okCommand10) {//GEN-LINE:|7-commandAction|15|148-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiRegla());//GEN-LINE:|7-commandAction|16|148-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|17|117-preAction
        } else if (displayable == guiEditPuntaje) {
            if (command == backCommand3) {//GEN-END:|7-commandAction|17|117-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiRegla());//GEN-LINE:|7-commandAction|18|117-postAction
                // write post-action user code here
            } else if (command == okCommand9) {//GEN-LINE:|7-commandAction|19|145-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiRegla());//GEN-LINE:|7-commandAction|20|145-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|21|132-preAction
        } else if (displayable == guiEditPuntajeInicial) {
            if (command == backCommand7) {//GEN-END:|7-commandAction|21|132-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJugador());//GEN-LINE:|7-commandAction|22|132-postAction
                // write post-action user code here
            } else if (command == okCommand13) {//GEN-LINE:|7-commandAction|23|157-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJugador());//GEN-LINE:|7-commandAction|24|157-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|25|59-preAction
        } else if (displayable == guiJuego) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|25|59-preAction
                // write pre-action user code here
                guiJuegoAction();//GEN-LINE:|7-commandAction|26|59-postAction
                // write post-action user code here
            } else if (command == cancelCommand1) {//GEN-LINE:|7-commandAction|27|203-preAction
                // write pre-action user code here
                juegoActual = null;
                getGuiEditNombreJuego().setString(""); // Borrar para próxima edición.
                switchDisplayable(null, getGuiOpciones());//GEN-LINE:|7-commandAction|28|203-postAction
                // write post-action user code here
            } else if (command == okCommand2) {//GEN-LINE:|7-commandAction|29|205-preAction
                // write pre-action user code here
                juegoActual.setNombre(getGuiEditNombreJuego().getString());
                getHashJuegos().put(juegoActual.getNombre(), juegoActual);
                getGuiJuego().setTitle("Juego " + getGuiEditNombreJuego().getString()); // Agregar nombre del juego en el Título de GuiJuego.
                getGuiEditNombreJuego().setString(""); // Borrar para próxima edición.
                switchDisplayable(null, getGuiOpciones());//GEN-LINE:|7-commandAction|30|205-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|31|52-preAction
        } else if (displayable == guiJugador) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|31|52-preAction
                // write pre-action user code here
                guiJugadorAction();//GEN-LINE:|7-commandAction|32|52-postAction
                // write post-action user code here
            } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|33|92-preAction
                // write pre-action user code here
                getGuiEditNombreJugador().setString("");                        // Borrar para próxima edición.
                getGuiEditPuntajeInicial().setString("");                       // Borrar para próxima edición.
                getGuiEditCantidadVidas().setString("");                        // Borrar para próxima edición.
                switchDisplayable(null, getGuiPartida());//GEN-LINE:|7-commandAction|34|92-postAction
                // write post-action user code here
            } else if (command == okCommand1) {//GEN-LINE:|7-commandAction|35|200-preAction
                // write pre-action user code here
                // OJO COMPROBAR QUE EL NOMBRE NO SEA NULO
                System.out.println("Editando Jugador: OJO COMPROBAR QUE EL NOMBRE NO SEA NULO");
                Jugador jugador = new Jugador(getGuiEditNombreJugador().getString(), Float.valueOf(getGuiEditPuntajeInicial().getString()), Integer.valueOf(getGuiEditCantidadVidas().getString()));
                juegoActual.getHashJugadores().put(jugador.getNombre(), jugador); // Agrega jugador al Juego Actual.
                getGuiEditNombreJugador().setString("");                        // Borrar para próxima edición.
                getGuiEditPuntajeInicial().setString("");                       // Borrar para próxima edición.
                getGuiEditCantidadVidas().setString("");                        // Borrar para próxima edición.
                switchDisplayable(null, getGuiPartida());//GEN-LINE:|7-commandAction|36|200-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|37|172-preAction
        } else if (displayable == guiListaJuegos) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|37|172-preAction
                // write pre-action user code here
                guiListaJuegosAction();//GEN-LINE:|7-commandAction|38|172-postAction
                // write post-action user code here
            } else if (command == backCommand9) {//GEN-LINE:|7-commandAction|39|178-preAction
                // write pre-action user code here
                juegoActual = null;
                switchDisplayable(null, getGuiOpciones());//GEN-LINE:|7-commandAction|40|178-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|41|193-preAction
        } else if (displayable == guiListaReglas) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|41|193-preAction
                // write pre-action user code here
                guiListaReglasAction();//GEN-LINE:|7-commandAction|42|193-postAction
                // write post-action user code here
            } else if (command == backCommand) {//GEN-LINE:|7-commandAction|43|197-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJuego());//GEN-LINE:|7-commandAction|44|197-postAction
                // write post-action user code here
            } else if (command == editarReglaCommand) {//GEN-LINE:|7-commandAction|45|211-preAction
                // write pre-action user code here
                // Tengo un lista de reglas de donde se puede obtener el INDICE de la seleccionada.
                // Necesito obtener su nombre y puntaje, los cuales pertenecer a una Regla (en hash) dentro del Juego Actual.

                int indice = getGuiListaReglas().getSelectedIndex();

                // El nombre lo obtengo gracias al indice
                getGuiEditNombreRegla().setString(getGuiListaReglas().getString(indice));

                // El puntaje lo obtengo, buscando la Regla en el Juego Actual. Para esto último es necesario el Nombre de la Regla.
                getGuiEditPuntaje().setString(((Regla)(juegoActual.getHashReglas().get(getGuiEditNombreRegla().getString()))).getPuntaje().toString());

                switchDisplayable(null, getGuiRegla());//GEN-LINE:|7-commandAction|46|211-postAction
                // write post-action user code here
            } else if (command == eliminarReglaCommand) {//GEN-LINE:|7-commandAction|47|209-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|48|209-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|49|30-preAction
        } else if (displayable == guiOpciones) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|49|30-preAction
                // write pre-action user code here
                guiOpcionesAction();//GEN-LINE:|7-commandAction|50|30-postAction
                // write post-action user code here
            } else if (command == exitCommand1) {//GEN-LINE:|7-commandAction|51|33-preAction
                // write pre-action user code here
                exitMIDlet();//GEN-LINE:|7-commandAction|52|33-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|53|160-preAction
        } else if (displayable == guiPartida) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|53|160-preAction
                // write pre-action user code here
                guiPartidaAction();//GEN-LINE:|7-commandAction|54|160-postAction
                // write post-action user code here
            } else if (command == backCommand8) {//GEN-LINE:|7-commandAction|55|169-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|56|169-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|57|84-preAction
        } else if (displayable == guiRegla) {
            if (command == List.SELECT_COMMAND) {//GEN-END:|7-commandAction|57|84-preAction
                // write pre-action user code here
                guiReglaAction();//GEN-LINE:|7-commandAction|58|84-postAction
                // write post-action user code here
            } else if (command == cancelCommand) {//GEN-LINE:|7-commandAction|59|91-preAction
                // write pre-action user code here
                getGuiEditNombreRegla().setString("");                          // Borrar para próxima edición.
                getGuiEditPuntaje().setString("");                              // Borrar para próxima edición.
                switchDisplayable(null, getGuiJuego());//GEN-LINE:|7-commandAction|60|91-postAction
                // write post-action user code here
            } else if (command == okCommand) {//GEN-LINE:|7-commandAction|61|189-preAction
                // write pre-action user code here
                // OJO COMPROBAR QUE EL NOMBRE NO SEA NULO
                System.out.println("Editando Regla: OJO COMPROBAR QUE EL NOMBRE NO SEA NULO. LO MISMO PARA NOMBRE DE JUEGO");
                Regla regla = new Regla(getGuiEditNombreRegla().getString(), Float.valueOf(getGuiEditPuntaje().getString()));
                juegoActual.getHashReglas().put(regla.getNombre(), regla);      // Agregar regla al Juego Actual.
                getGuiEditNombreRegla().setString("");                          // Borrar para próxima edición.
                getGuiEditPuntaje().setString("");                              // Borrar para próxima edición.
                switchDisplayable(null, getGuiJuego());//GEN-LINE:|7-commandAction|62|189-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|63|24-preAction
        } else if (displayable == waitScreen) {
            if (command == WaitScreen.FAILURE_COMMAND) {//GEN-END:|7-commandAction|63|24-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|64|24-postAction
                // write post-action user code here
            } else if (command == WaitScreen.SUCCESS_COMMAND) {//GEN-LINE:|7-commandAction|65|23-preAction
                // write pre-action user code here
//GEN-LINE:|7-commandAction|66|23-postAction
                // write post-action user code here
            }//GEN-BEGIN:|7-commandAction|67|7-postCommandAction
        }//GEN-END:|7-commandAction|67|7-postCommandAction
        // write post-action user code here
    }//GEN-BEGIN:|7-commandAction|68|
    //</editor-fold>//GEN-END:|7-commandAction|68|






    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: waitScreen ">//GEN-BEGIN:|20-getter|0|20-preInit
    /**
     * Returns an initiliazed instance of waitScreen component.
     * @return the initialized component instance
     */
    public WaitScreen getWaitScreen() {
        if (waitScreen == null) {//GEN-END:|20-getter|0|20-preInit
            // write pre-init user code here
            waitScreen = new WaitScreen(getDisplay());//GEN-BEGIN:|20-getter|1|20-postInit
            waitScreen.setCommandListener(this);
            waitScreen.setFullScreenMode(true);
            waitScreen.setImage(getImage1());
            waitScreen.setText("Cargando...");
            waitScreen.setTask(getTask());//GEN-END:|20-getter|1|20-postInit
            // write post-init user code here
        }//GEN-BEGIN:|20-getter|2|
        return waitScreen;
    }
    //</editor-fold>//GEN-END:|20-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: task ">//GEN-BEGIN:|25-getter|0|25-preInit
    /**
     * Returns an initiliazed instance of task component.
     * @return the initialized component instance
     */
    public SimpleCancellableTask getTask() {
        if (task == null) {//GEN-END:|25-getter|0|25-preInit
            // write pre-init user code here
            task = new SimpleCancellableTask();//GEN-BEGIN:|25-getter|1|25-execute
            task.setExecutable(new org.netbeans.microedition.util.Executable() {
                public void execute() throws Exception {//GEN-END:|25-getter|1|25-execute
                    // write task-execution user code here
                    Thread.sleep(1300);
                    switchDisplayable (null, getGuiOpciones());
                }//GEN-BEGIN:|25-getter|2|25-postInit
            });//GEN-END:|25-getter|2|25-postInit
            // write post-init user code here
        }//GEN-BEGIN:|25-getter|3|
        return task;
    }
    //</editor-fold>//GEN-END:|25-getter|3|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: image1 ">//GEN-BEGIN:|27-getter|0|27-preInit
    /**
     * Returns an initiliazed instance of image1 component.
     * @return the initialized component instance
     */
    public Image getImage1() {
        if (image1 == null) {//GEN-END:|27-getter|0|27-preInit
            // write pre-init user code here
            try {//GEN-BEGIN:|27-getter|1|27-@java.io.IOException
                image1 = Image.createImage("/res/gNotePresentacion.jpg");
            } catch (java.io.IOException e) {//GEN-END:|27-getter|1|27-@java.io.IOException
                e.printStackTrace();
            }//GEN-LINE:|27-getter|2|27-postInit
            // write post-init user code here
        }//GEN-BEGIN:|27-getter|3|
        return image1;
    }
    //</editor-fold>//GEN-END:|27-getter|3|
    //</editor-fold>
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiOpciones ">//GEN-BEGIN:|28-getter|0|28-preInit
    /**
     * Returns an initiliazed instance of guiOpciones component.
     * @return the initialized component instance
     */
    public List getGuiOpciones() {
        if (guiOpciones == null) {//GEN-END:|28-getter|0|28-preInit
            // write pre-init user code here
            guiOpciones = new List("Opciones", Choice.IMPLICIT);//GEN-BEGIN:|28-getter|1|28-postInit
            guiOpciones.append("Jugar", null);
            guiOpciones.append("Crear Juego", null);
            guiOpciones.append("Eliminar Juego", null);
            guiOpciones.addCommand(getExitCommand1());
            guiOpciones.setCommandListener(this);
            guiOpciones.setSelectedFlags(new boolean[] { false, false, false });//GEN-END:|28-getter|1|28-postInit
            // write post-init user code here
        }//GEN-BEGIN:|28-getter|2|
        return guiOpciones;
    }
    //</editor-fold>//GEN-END:|28-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: guiOpcionesAction ">//GEN-BEGIN:|28-action|0|28-preAction
    /**
     * Performs an action assigned to the selected list element in the guiOpciones component.
     */
    public void guiOpcionesAction() {//GEN-END:|28-action|0|28-preAction
        // enter pre-action user code here
        String __selectedString = getGuiOpciones().getString(getGuiOpciones().getSelectedIndex());//GEN-BEGIN:|28-action|1|37-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Jugar")) {//GEN-END:|28-action|1|37-preAction
                // write pre-action user code here
                System.out.println("Jugar");
                if(getHashJuegos().isEmpty()){
                    getWaitScreen().setText("No hay Juegos!");
                    getWaitScreen().setImage(null);
                    switchDisplayable(null, getWaitScreen());
                }else{
                    switchDisplayable(null, getGuiListaJuegos());
                }
//GEN-LINE:|28-action|2|37-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Crear Juego")) {//GEN-LINE:|28-action|3|34-preAction
                // write pre-action user code here
                System.out.println("Crear Juego");
                juegoActual = new Juego("");
                switchDisplayable(null, getGuiJuego());//GEN-LINE:|28-action|4|34-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Eliminar Juego")) {//GEN-LINE:|28-action|5|35-preAction
                // write pre-action user code here
                System.out.println("Eliminar Juego");
//GEN-LINE:|28-action|6|35-postAction
                // write post-action user code here
            }//GEN-BEGIN:|28-action|7|28-postAction
        }//GEN-END:|28-action|7|28-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|28-action|8|
    //</editor-fold>//GEN-END:|28-action|8|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand1 ">//GEN-BEGIN:|32-getter|0|32-preInit
    /**
     * Returns an initiliazed instance of exitCommand1 component.
     * @return the initialized component instance
     */
    public Command getExitCommand1() {
        if (exitCommand1 == null) {//GEN-END:|32-getter|0|32-preInit
            // write pre-init user code here
            exitCommand1 = new Command("Exit", Command.EXIT, 0);//GEN-LINE:|32-getter|1|32-postInit
            // write post-init user code here
        }//GEN-BEGIN:|32-getter|2|
        return exitCommand1;
    }
    //</editor-fold>//GEN-END:|32-getter|2|
    //</editor-fold>
    //</editor-fold>









    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiJugador ">//GEN-BEGIN:|51-getter|0|51-preInit
    /**
     * Returns an initiliazed instance of guiJugador component.
     * @return the initialized component instance
     */
    public List getGuiJugador() {
        if (guiJugador == null) {//GEN-END:|51-getter|0|51-preInit
            // write pre-init user code here
            guiJugador = new List("Jugador", Choice.IMPLICIT);//GEN-BEGIN:|51-getter|1|51-postInit
            guiJugador.append("Editar Nombre", null);
            guiJugador.append("Editar Puntaje", null);
            guiJugador.append("Editar Vidas", null);
            guiJugador.addCommand(getCancelCommand());
            guiJugador.addCommand(getOkCommand1());
            guiJugador.setCommandListener(this);
            guiJugador.setSelectedFlags(new boolean[] { false, false, false });//GEN-END:|51-getter|1|51-postInit
            // write post-init user code here
        }//GEN-BEGIN:|51-getter|2|
        return guiJugador;
    }
    //</editor-fold>//GEN-END:|51-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: guiJugadorAction ">//GEN-BEGIN:|51-action|0|51-preAction
    /**
     * Performs an action assigned to the selected list element in the guiJugador component.
     */
    public void guiJugadorAction() {//GEN-END:|51-action|0|51-preAction
        // enter pre-action user code here
        String __selectedString = getGuiJugador().getString(getGuiJugador().getSelectedIndex());//GEN-BEGIN:|51-action|1|54-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Editar Nombre")) {//GEN-END:|51-action|1|54-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiEditNombreJugador());//GEN-LINE:|51-action|2|54-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Editar Puntaje")) {//GEN-LINE:|51-action|3|55-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiEditPuntajeInicial());//GEN-LINE:|51-action|4|55-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Editar Vidas")) {//GEN-LINE:|51-action|5|56-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiEditCantidadVidas());//GEN-LINE:|51-action|6|56-postAction
                // write post-action user code here
            }//GEN-BEGIN:|51-action|7|51-postAction
        }//GEN-END:|51-action|7|51-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|51-action|8|
    //</editor-fold>//GEN-END:|51-action|8|
    //</editor-fold>
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiJuego ">//GEN-BEGIN:|58-getter|0|58-preInit
    /**
     * Returns an initiliazed instance of guiJuego component.
     * @return the initialized component instance
     */
    public List getGuiJuego() {
        if (guiJuego == null) {//GEN-END:|58-getter|0|58-preInit
            // write pre-init user code here
            guiJuego = new List("Juego", Choice.IMPLICIT);//GEN-BEGIN:|58-getter|1|58-postInit
            guiJuego.append("Editar Nombre", null);
            guiJuego.append("Agregar Regla", null);
            guiJuego.append("Ver Reglas", null);
            guiJuego.addCommand(getCancelCommand1());
            guiJuego.addCommand(getOkCommand2());
            guiJuego.setCommandListener(this);
            guiJuego.setSelectedFlags(new boolean[] { false, false, false });//GEN-END:|58-getter|1|58-postInit
            // write post-init user code here
        }//GEN-BEGIN:|58-getter|2|
        return guiJuego;
    }
    //</editor-fold>//GEN-END:|58-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: guiJuegoAction ">//GEN-BEGIN:|58-action|0|58-preAction
    /**
     * Performs an action assigned to the selected list element in the guiJuego component.
     */
    public void guiJuegoAction() {//GEN-END:|58-action|0|58-preAction
        // enter pre-action user code here
        String __selectedString = getGuiJuego().getString(getGuiJuego().getSelectedIndex());//GEN-BEGIN:|58-action|1|61-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Editar Nombre")) {//GEN-END:|58-action|1|61-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiEditNombreJuego());//GEN-LINE:|58-action|2|61-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Agregar Regla")) {//GEN-LINE:|58-action|3|62-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiRegla());//GEN-LINE:|58-action|4|62-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Ver Reglas")) {//GEN-LINE:|58-action|5|63-preAction
                // write pre-action user code here
                if(juegoActual.getHashReglas().isEmpty()){
                    getWaitScreen().setText("No hay Reglas!");
                    getWaitScreen().setImage(null);
                    switchDisplayable(null, getWaitScreen());
                }else{
                    switchDisplayable(null, getGuiListaReglas());//GEN-LINE:|58-action|6|63-postAction
                // write post-action user code here
                }
            }//GEN-BEGIN:|58-action|7|58-postAction
        }//GEN-END:|58-action|7|58-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|58-action|8|
    //</editor-fold>//GEN-END:|58-action|8|







    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand1 ">//GEN-BEGIN:|75-getter|0|75-preInit
    /**
     * Returns an initiliazed instance of backCommand1 component.
     * @return the initialized component instance
     */
    public Command getBackCommand1() {
        if (backCommand1 == null) {//GEN-END:|75-getter|0|75-preInit
            // write pre-init user code here
            backCommand1 = new Command("Listo", Command.BACK, 0);//GEN-LINE:|75-getter|1|75-postInit
            // write post-init user code here
        }//GEN-BEGIN:|75-getter|2|
        return backCommand1;
    }
    //</editor-fold>//GEN-END:|75-getter|2|
    //</editor-fold>





    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiRegla ">//GEN-BEGIN:|83-getter|0|83-preInit
    /**
     * Returns an initiliazed instance of guiRegla component.
     * @return the initialized component instance
     */
    public List getGuiRegla() {
        if (guiRegla == null) {//GEN-END:|83-getter|0|83-preInit
            // write pre-init user code here
            guiRegla = new List("Regla", Choice.IMPLICIT);//GEN-BEGIN:|83-getter|1|83-postInit
            guiRegla.append("Editar Nombre", null);
            guiRegla.append("Editar Puntaje", null);
            guiRegla.addCommand(getCancelCommand());
            guiRegla.addCommand(getOkCommand());
            guiRegla.setCommandListener(this);
            guiRegla.setSelectedFlags(new boolean[] { false, false });//GEN-END:|83-getter|1|83-postInit
            // write post-init user code here
        }//GEN-BEGIN:|83-getter|2|
        return guiRegla;
    }
    //</editor-fold>//GEN-END:|83-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: guiReglaAction ">//GEN-BEGIN:|83-action|0|83-preAction
    /**
     * Performs an action assigned to the selected list element in the guiRegla component.
     */
    public void guiReglaAction() {//GEN-END:|83-action|0|83-preAction
        // enter pre-action user code here
        String __selectedString = getGuiRegla().getString(getGuiRegla().getSelectedIndex());//GEN-BEGIN:|83-action|1|86-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Editar Nombre")) {//GEN-END:|83-action|1|86-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiEditNombreRegla());//GEN-LINE:|83-action|2|86-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Editar Puntaje")) {//GEN-LINE:|83-action|3|87-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiEditPuntaje());//GEN-LINE:|83-action|4|87-postAction
                // write post-action user code here
            }//GEN-BEGIN:|83-action|5|83-postAction
        }//GEN-END:|83-action|5|83-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|83-action|6|
    //</editor-fold>//GEN-END:|83-action|6|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: cancelCommand ">//GEN-BEGIN:|90-getter|0|90-preInit
    /**
     * Returns an initiliazed instance of cancelCommand component.
     * @return the initialized component instance
     */
    public Command getCancelCommand() {
        if (cancelCommand == null) {//GEN-END:|90-getter|0|90-preInit
            // write pre-init user code here
            cancelCommand = new Command("Cancel", Command.CANCEL, 0);//GEN-LINE:|90-getter|1|90-postInit
            // write post-init user code here
        }//GEN-BEGIN:|90-getter|2|
        return cancelCommand;
    }
    //</editor-fold>//GEN-END:|90-getter|2|
    //</editor-fold>
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiEditNombreRegla ">//GEN-BEGIN:|104-getter|0|104-preInit
    /**
     * Returns an initiliazed instance of guiEditNombreRegla component.
     * @return the initialized component instance
     */
    public TextBox getGuiEditNombreRegla() {
        if (guiEditNombreRegla == null) {//GEN-END:|104-getter|0|104-preInit
            // write pre-init user code here
            guiEditNombreRegla = new TextBox("Nombre de Regla", "", 100, TextField.ANY);//GEN-BEGIN:|104-getter|1|104-postInit
            guiEditNombreRegla.addCommand(getBackCommand5());
            guiEditNombreRegla.addCommand(getOkCommand10());
            guiEditNombreRegla.setCommandListener(this);//GEN-END:|104-getter|1|104-postInit
            // write post-init user code here
        }//GEN-BEGIN:|104-getter|2|
        return guiEditNombreRegla;
    }
    //</editor-fold>//GEN-END:|104-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiEditPuntaje ">//GEN-BEGIN:|106-getter|0|106-preInit
    /**
     * Returns an initiliazed instance of guiEditPuntaje component.
     * @return the initialized component instance
     */
    public TextBox getGuiEditPuntaje() {
        if (guiEditPuntaje == null) {//GEN-END:|106-getter|0|106-preInit
            // write pre-init user code here
            guiEditPuntaje = new TextBox("Valor de Puntaje", "", 10, TextField.NUMERIC);//GEN-BEGIN:|106-getter|1|106-postInit
            guiEditPuntaje.addCommand(getBackCommand3());
            guiEditPuntaje.addCommand(getOkCommand9());
            guiEditPuntaje.setCommandListener(this);//GEN-END:|106-getter|1|106-postInit
            // write post-init user code here
        }//GEN-BEGIN:|106-getter|2|
        return guiEditPuntaje;
    }
    //</editor-fold>//GEN-END:|106-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiEditNombreJugador ">//GEN-BEGIN:|108-getter|0|108-preInit
    /**
     * Returns an initiliazed instance of guiEditNombreJugador component.
     * @return the initialized component instance
     */
    public TextBox getGuiEditNombreJugador() {
        if (guiEditNombreJugador == null) {//GEN-END:|108-getter|0|108-preInit
            // write pre-init user code here
            guiEditNombreJugador = new TextBox("Nombre de Jugador", "", 100, TextField.ANY);//GEN-BEGIN:|108-getter|1|108-postInit
            guiEditNombreJugador.addCommand(getBackCommand4());
            guiEditNombreJugador.addCommand(getOkCommand11());
            guiEditNombreJugador.setCommandListener(this);//GEN-END:|108-getter|1|108-postInit
            // write post-init user code here
        }//GEN-BEGIN:|108-getter|2|
        return guiEditNombreJugador;
    }
    //</editor-fold>//GEN-END:|108-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiEditPuntajeInicial ">//GEN-BEGIN:|109-getter|0|109-preInit
    /**
     * Returns an initiliazed instance of guiEditPuntajeInicial component.
     * @return the initialized component instance
     */
    public TextBox getGuiEditPuntajeInicial() {
        if (guiEditPuntajeInicial == null) {//GEN-END:|109-getter|0|109-preInit
            // write pre-init user code here
            guiEditPuntajeInicial = new TextBox("Puntaje Inicial", null, 10, TextField.NUMERIC);//GEN-BEGIN:|109-getter|1|109-postInit
            guiEditPuntajeInicial.addCommand(getBackCommand7());
            guiEditPuntajeInicial.addCommand(getOkCommand13());
            guiEditPuntajeInicial.setCommandListener(this);//GEN-END:|109-getter|1|109-postInit
            // write post-init user code here
        }//GEN-BEGIN:|109-getter|2|
        return guiEditPuntajeInicial;
    }
    //</editor-fold>//GEN-END:|109-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiEditCantidadVidas ">//GEN-BEGIN:|110-getter|0|110-preInit
    /**
     * Returns an initiliazed instance of guiEditCantidadVidas component.
     * @return the initialized component instance
     */
    public TextBox getGuiEditCantidadVidas() {
        if (guiEditCantidadVidas == null) {//GEN-END:|110-getter|0|110-preInit
            // write pre-init user code here
            guiEditCantidadVidas = new TextBox("Cantidad de Vidas", null, 4, TextField.NUMERIC);//GEN-BEGIN:|110-getter|1|110-postInit
            guiEditCantidadVidas.addCommand(getBackCommand6());
            guiEditCantidadVidas.addCommand(getOkCommand12());
            guiEditCantidadVidas.setCommandListener(this);//GEN-END:|110-getter|1|110-postInit
            // write post-init user code here
        }//GEN-BEGIN:|110-getter|2|
        return guiEditCantidadVidas;
    }
    //</editor-fold>//GEN-END:|110-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand3 ">//GEN-BEGIN:|116-getter|0|116-preInit
    /**
     * Returns an initiliazed instance of backCommand3 component.
     * @return the initialized component instance
     */
    public Command getBackCommand3() {
        if (backCommand3 == null) {//GEN-END:|116-getter|0|116-preInit
            // write pre-init user code here
            backCommand3 = new Command("Back", Command.BACK, 0);//GEN-LINE:|116-getter|1|116-postInit
            // write post-init user code here
        }//GEN-BEGIN:|116-getter|2|
        return backCommand3;
    }
    //</editor-fold>//GEN-END:|116-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand4 ">//GEN-BEGIN:|121-getter|0|121-preInit
    /**
     * Returns an initiliazed instance of backCommand4 component.
     * @return the initialized component instance
     */
    public Command getBackCommand4() {
        if (backCommand4 == null) {//GEN-END:|121-getter|0|121-preInit
            // write pre-init user code here
            backCommand4 = new Command("Back", Command.BACK, 0);//GEN-LINE:|121-getter|1|121-postInit
            // write post-init user code here
        }//GEN-BEGIN:|121-getter|2|
        return backCommand4;
    }
    //</editor-fold>//GEN-END:|121-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand5 ">//GEN-BEGIN:|125-getter|0|125-preInit
    /**
     * Returns an initiliazed instance of backCommand5 component.
     * @return the initialized component instance
     */
    public Command getBackCommand5() {
        if (backCommand5 == null) {//GEN-END:|125-getter|0|125-preInit
            // write pre-init user code here
            backCommand5 = new Command("Back", Command.BACK, 0);//GEN-LINE:|125-getter|1|125-postInit
            // write post-init user code here
        }//GEN-BEGIN:|125-getter|2|
        return backCommand5;
    }
    //</editor-fold>//GEN-END:|125-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand6 ">//GEN-BEGIN:|127-getter|0|127-preInit
    /**
     * Returns an initiliazed instance of backCommand6 component.
     * @return the initialized component instance
     */
    public Command getBackCommand6() {
        if (backCommand6 == null) {//GEN-END:|127-getter|0|127-preInit
            // write pre-init user code here
            backCommand6 = new Command("Back", Command.BACK, 0);//GEN-LINE:|127-getter|1|127-postInit
            // write post-init user code here
        }//GEN-BEGIN:|127-getter|2|
        return backCommand6;
    }
    //</editor-fold>//GEN-END:|127-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand7 ">//GEN-BEGIN:|131-getter|0|131-preInit
    /**
     * Returns an initiliazed instance of backCommand7 component.
     * @return the initialized component instance
     */
    public Command getBackCommand7() {
        if (backCommand7 == null) {//GEN-END:|131-getter|0|131-preInit
            // write pre-init user code here
            backCommand7 = new Command("Back", Command.BACK, 0);//GEN-LINE:|131-getter|1|131-postInit
            // write post-init user code here
        }//GEN-BEGIN:|131-getter|2|
        return backCommand7;
    }
    //</editor-fold>//GEN-END:|131-getter|2|



    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand9 ">//GEN-BEGIN:|144-getter|0|144-preInit
    /**
     * Returns an initiliazed instance of okCommand9 component.
     * @return the initialized component instance
     */
    public Command getOkCommand9() {
        if (okCommand9 == null) {//GEN-END:|144-getter|0|144-preInit
            // write pre-init user code here
            okCommand9 = new Command("Ok", Command.OK, 0);//GEN-LINE:|144-getter|1|144-postInit
            // write post-init user code here
        }//GEN-BEGIN:|144-getter|2|
        return okCommand9;
    }
    //</editor-fold>//GEN-END:|144-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand10 ">//GEN-BEGIN:|147-getter|0|147-preInit
    /**
     * Returns an initiliazed instance of okCommand10 component.
     * @return the initialized component instance
     */
    public Command getOkCommand10() {
        if (okCommand10 == null) {//GEN-END:|147-getter|0|147-preInit
            // write pre-init user code here
            okCommand10 = new Command("Ok", Command.OK, 0);//GEN-LINE:|147-getter|1|147-postInit
            // write post-init user code here
        }//GEN-BEGIN:|147-getter|2|
        return okCommand10;
    }
    //</editor-fold>//GEN-END:|147-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand11 ">//GEN-BEGIN:|150-getter|0|150-preInit
    /**
     * Returns an initiliazed instance of okCommand11 component.
     * @return the initialized component instance
     */
    public Command getOkCommand11() {
        if (okCommand11 == null) {//GEN-END:|150-getter|0|150-preInit
            // write pre-init user code here
            okCommand11 = new Command("Ok", Command.OK, 0);//GEN-LINE:|150-getter|1|150-postInit
            // write post-init user code here
        }//GEN-BEGIN:|150-getter|2|
        return okCommand11;
    }
    //</editor-fold>//GEN-END:|150-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand12 ">//GEN-BEGIN:|153-getter|0|153-preInit
    /**
     * Returns an initiliazed instance of okCommand12 component.
     * @return the initialized component instance
     */
    public Command getOkCommand12() {
        if (okCommand12 == null) {//GEN-END:|153-getter|0|153-preInit
            // write pre-init user code here
            okCommand12 = new Command("Ok", Command.OK, 0);//GEN-LINE:|153-getter|1|153-postInit
            // write post-init user code here
        }//GEN-BEGIN:|153-getter|2|
        return okCommand12;
    }
    //</editor-fold>//GEN-END:|153-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand13 ">//GEN-BEGIN:|156-getter|0|156-preInit
    /**
     * Returns an initiliazed instance of okCommand13 component.
     * @return the initialized component instance
     */
    public Command getOkCommand13() {
        if (okCommand13 == null) {//GEN-END:|156-getter|0|156-preInit
            // write pre-init user code here
            okCommand13 = new Command("Ok", Command.OK, 0);//GEN-LINE:|156-getter|1|156-postInit
            // write post-init user code here
        }//GEN-BEGIN:|156-getter|2|
        return okCommand13;
    }
    //</editor-fold>//GEN-END:|156-getter|2|
    //</editor-fold>
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiPartida ">//GEN-BEGIN:|159-getter|0|159-preInit
    /**
     * Returns an initiliazed instance of guiPartida component.
     * @return the initialized component instance
     */
    public List getGuiPartida() {
        if (guiPartida == null) {//GEN-END:|159-getter|0|159-preInit
            // write pre-init user code here
            guiPartida = new List("Partida", Choice.IMPLICIT);//GEN-BEGIN:|159-getter|1|159-postInit
            guiPartida.append("Agregar Jugador", null);
            guiPartida.append("Eliminar Jugador", null);
            guiPartida.append("Iniciar", null);
            guiPartida.addCommand(getBackCommand8());
            guiPartida.setCommandListener(this);
            guiPartida.setSelectedFlags(new boolean[] { false, false, false });//GEN-END:|159-getter|1|159-postInit
            // write post-init user code here
        }//GEN-BEGIN:|159-getter|2|
        return guiPartida;
    }
    //</editor-fold>//GEN-END:|159-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: guiPartidaAction ">//GEN-BEGIN:|159-action|0|159-preAction
    /**
     * Performs an action assigned to the selected list element in the guiPartida component.
     */
    public void guiPartidaAction() {//GEN-END:|159-action|0|159-preAction
        // enter pre-action user code here
        String __selectedString = getGuiPartida().getString(getGuiPartida().getSelectedIndex());//GEN-BEGIN:|159-action|1|162-preAction
        if (__selectedString != null) {
            if (__selectedString.equals("Agregar Jugador")) {//GEN-END:|159-action|1|162-preAction
                // write pre-action user code here
                switchDisplayable(null, getGuiJugador());//GEN-LINE:|159-action|2|162-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Eliminar Jugador")) {//GEN-LINE:|159-action|3|163-preAction
                // write pre-action user code here
//GEN-LINE:|159-action|4|163-postAction
                // write post-action user code here
            } else if (__selectedString.equals("Iniciar")) {//GEN-LINE:|159-action|5|164-preAction
                // write pre-action user code here
                if(juegoActual.getHashJugadores().isEmpty()){
                    getWaitScreen().setText("No hay Jugadores!");
                    getWaitScreen().setImage(null);
                    switchDisplayable(null, getWaitScreen());
                }
//GEN-LINE:|159-action|6|164-postAction
                // write post-action user code here
            }//GEN-BEGIN:|159-action|7|159-postAction
        }//GEN-END:|159-action|7|159-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|159-action|8|
    //</editor-fold>//GEN-END:|159-action|8|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand8 ">//GEN-BEGIN:|168-getter|0|168-preInit
    /**
     * Returns an initiliazed instance of backCommand8 component.
     * @return the initialized component instance
     */
    public Command getBackCommand8() {
        if (backCommand8 == null) {//GEN-END:|168-getter|0|168-preInit
            // write pre-init user code here
            backCommand8 = new Command("Back", Command.BACK, 0);//GEN-LINE:|168-getter|1|168-postInit
            // write post-init user code here
        }//GEN-BEGIN:|168-getter|2|
        return backCommand8;
    }
    //</editor-fold>//GEN-END:|168-getter|2|
    //</editor-fold>
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiListaJuegos ">//GEN-BEGIN:|171-getter|0|171-preInit
    /**
     * Returns an initiliazed instance of guiListaJuegos component.
     * @return the initialized component instance
     */
    public List getGuiListaJuegos() {
        if (guiListaJuegos == null) {//GEN-END:|171-getter|0|171-preInit
            // write pre-init user code here
            guiListaJuegos = new List("Lista de Juegos", Choice.IMPLICIT);//GEN-BEGIN:|171-getter|1|171-postInit
            guiListaJuegos.addCommand(getBackCommand9());
            guiListaJuegos.setCommandListener(this);//GEN-END:|171-getter|1|171-postInit
            // write post-init user code here
            // Agrego todos los Juegos contenidos en el correspondiente hash.
            Enumeration e = getHashJuegos().elements();
            while(e.hasMoreElements()){
                guiListaJuegos.append(((Juego)e.nextElement()).getNombre(), null);
            }
        }//GEN-BEGIN:|171-getter|2|
        return guiListaJuegos;
    }
    //</editor-fold>//GEN-END:|171-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: guiListaJuegosAction ">//GEN-BEGIN:|171-action|0|171-preAction
    /**
     * Performs an action assigned to the selected list element in the guiListaJuegos component.
     */
    public void guiListaJuegosAction() {//GEN-END:|171-action|0|171-preAction
        // enter pre-action user code here
        String __selectedString = getGuiListaJuegos().getString(getGuiListaJuegos().getSelectedIndex());//GEN-LINE:|171-action|1|171-postAction
        // enter post-action user code here
        // Obtener y preservar el Juego seleccionado
        juegoActual = (Juego)(getHashJuegos().get(__selectedString));
        switchDisplayable(null, getGuiPartida());
    }//GEN-BEGIN:|171-action|2|
    //</editor-fold>//GEN-END:|171-action|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand9 ">//GEN-BEGIN:|177-getter|0|177-preInit
    /**
     * Returns an initiliazed instance of backCommand9 component.
     * @return the initialized component instance
     */
    public Command getBackCommand9() {
        if (backCommand9 == null) {//GEN-END:|177-getter|0|177-preInit
            // write pre-init user code here
            backCommand9 = new Command("Back", Command.BACK, 0);//GEN-LINE:|177-getter|1|177-postInit
            // write post-init user code here
        }//GEN-BEGIN:|177-getter|2|
        return backCommand9;
    }
    //</editor-fold>//GEN-END:|177-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiEditNombreJuego ">//GEN-BEGIN:|181-getter|0|181-preInit
    /**
     * Returns an initiliazed instance of guiEditNombreJuego component.
     * @return the initialized component instance
     */
    public TextBox getGuiEditNombreJuego() {
        if (guiEditNombreJuego == null) {//GEN-END:|181-getter|0|181-preInit
            // write pre-init user code here
            guiEditNombreJuego = new TextBox("Nombre", null, 100, TextField.ANY);//GEN-BEGIN:|181-getter|1|181-postInit
            guiEditNombreJuego.addCommand(getBackCommand10());
            guiEditNombreJuego.addCommand(getOkCommand14());
            guiEditNombreJuego.setCommandListener(this);//GEN-END:|181-getter|1|181-postInit
            // write post-init user code here
        }//GEN-BEGIN:|181-getter|2|
        return guiEditNombreJuego;
    }
    //</editor-fold>//GEN-END:|181-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand10 ">//GEN-BEGIN:|183-getter|0|183-preInit
    /**
     * Returns an initiliazed instance of backCommand10 component.
     * @return the initialized component instance
     */
    public Command getBackCommand10() {
        if (backCommand10 == null) {//GEN-END:|183-getter|0|183-preInit
            // write pre-init user code here
            backCommand10 = new Command("Back", Command.BACK, 0);//GEN-LINE:|183-getter|1|183-postInit
            // write post-init user code here
        }//GEN-BEGIN:|183-getter|2|
        return backCommand10;
    }
    //</editor-fold>//GEN-END:|183-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand14 ">//GEN-BEGIN:|185-getter|0|185-preInit
    /**
     * Returns an initiliazed instance of okCommand14 component.
     * @return the initialized component instance
     */
    public Command getOkCommand14() {
        if (okCommand14 == null) {//GEN-END:|185-getter|0|185-preInit
            // write pre-init user code here
            okCommand14 = new Command("Ok", Command.OK, 0);//GEN-LINE:|185-getter|1|185-postInit
            // write post-init user code here
        }//GEN-BEGIN:|185-getter|2|
        return okCommand14;
    }
    //</editor-fold>//GEN-END:|185-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand ">//GEN-BEGIN:|188-getter|0|188-preInit
    /**
     * Returns an initiliazed instance of okCommand component.
     * @return the initialized component instance
     */
    public Command getOkCommand() {
        if (okCommand == null) {//GEN-END:|188-getter|0|188-preInit
            // write pre-init user code here
            okCommand = new Command("Listo", Command.OK, 0);//GEN-LINE:|188-getter|1|188-postInit
            // write post-init user code here
        }//GEN-BEGIN:|188-getter|2|
        return okCommand;
    }
    //</editor-fold>//GEN-END:|188-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: guiListaReglas ">//GEN-BEGIN:|192-getter|0|192-preInit
    /**
     * Returns an initiliazed instance of guiListaReglas component.
     * @return the initialized component instance
     */
    public List getGuiListaReglas() {
        if (guiListaReglas == null) {//GEN-END:|192-getter|0|192-preInit
            // write pre-init user code here
            guiListaReglas = new List("Lista de Reglas", Choice.IMPLICIT);//GEN-BEGIN:|192-getter|1|192-postInit
            guiListaReglas.addCommand(getBackCommand());
            guiListaReglas.addCommand(getEliminarReglaCommand());
            guiListaReglas.addCommand(getEditarReglaCommand());
            guiListaReglas.setCommandListener(this);//GEN-END:|192-getter|1|192-postInit
            // write post-init user code here
            // Agrego todos los Juegos contenidos en el correspondiente hash.
            Enumeration e = juegoActual.getHashReglas().elements();
            while(e.hasMoreElements()){
                guiListaReglas.append(((Regla)e.nextElement()).getNombre(), null);
            }
        }//GEN-BEGIN:|192-getter|2|
        return guiListaReglas;
    }
    //</editor-fold>//GEN-END:|192-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Method: guiListaReglasAction ">//GEN-BEGIN:|192-action|0|192-preAction
    /**
     * Performs an action assigned to the selected list element in the guiListaReglas component.
     */
    public void guiListaReglasAction() {//GEN-END:|192-action|0|192-preAction
        // enter pre-action user code here
        String __selectedString = getGuiListaReglas().getString(getGuiListaReglas().getSelectedIndex());//GEN-LINE:|192-action|1|192-postAction
        // enter post-action user code here
    }//GEN-BEGIN:|192-action|2|
    //</editor-fold>//GEN-END:|192-action|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: backCommand ">//GEN-BEGIN:|196-getter|0|196-preInit
    /**
     * Returns an initiliazed instance of backCommand component.
     * @return the initialized component instance
     */
    public Command getBackCommand() {
        if (backCommand == null) {//GEN-END:|196-getter|0|196-preInit
            // write pre-init user code here
            backCommand = new Command("Back", Command.BACK, 0);//GEN-LINE:|196-getter|1|196-postInit
            // write post-init user code here
        }//GEN-BEGIN:|196-getter|2|
        return backCommand;
    }
    //</editor-fold>//GEN-END:|196-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand1 ">//GEN-BEGIN:|199-getter|0|199-preInit
    /**
     * Returns an initiliazed instance of okCommand1 component.
     * @return the initialized component instance
     */
    public Command getOkCommand1() {
        if (okCommand1 == null) {//GEN-END:|199-getter|0|199-preInit
            // write pre-init user code here
            okCommand1 = new Command("Listo", Command.OK, 0);//GEN-LINE:|199-getter|1|199-postInit
            // write post-init user code here
        }//GEN-BEGIN:|199-getter|2|
        return okCommand1;
    }
    //</editor-fold>//GEN-END:|199-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: cancelCommand1 ">//GEN-BEGIN:|202-getter|0|202-preInit
    /**
     * Returns an initiliazed instance of cancelCommand1 component.
     * @return the initialized component instance
     */
    public Command getCancelCommand1() {
        if (cancelCommand1 == null) {//GEN-END:|202-getter|0|202-preInit
            // write pre-init user code here
            cancelCommand1 = new Command("Cancel", Command.CANCEL, 0);//GEN-LINE:|202-getter|1|202-postInit
            // write post-init user code here
        }//GEN-BEGIN:|202-getter|2|
        return cancelCommand1;
    }
    //</editor-fold>//GEN-END:|202-getter|2|

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: okCommand2 ">//GEN-BEGIN:|204-getter|0|204-preInit
    /**
     * Returns an initiliazed instance of okCommand2 component.
     * @return the initialized component instance
     */
    public Command getOkCommand2() {
        if (okCommand2 == null) {//GEN-END:|204-getter|0|204-preInit
            // write pre-init user code here
            okCommand2 = new Command("Ok", Command.OK, 0);//GEN-LINE:|204-getter|1|204-postInit
            // write post-init user code here
        }//GEN-BEGIN:|204-getter|2|
        return okCommand2;
    }
    //</editor-fold>//GEN-END:|204-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: eliminarReglaCommand ">//GEN-BEGIN:|208-getter|0|208-preInit
    /**
     * Returns an initiliazed instance of eliminarReglaCommand component.
     * @return the initialized component instance
     */
    public Command getEliminarReglaCommand() {
        if (eliminarReglaCommand == null) {//GEN-END:|208-getter|0|208-preInit
            // write pre-init user code here
            eliminarReglaCommand = new Command("Eliminar", Command.ITEM, 0);//GEN-LINE:|208-getter|1|208-postInit
            // write post-init user code here
        }//GEN-BEGIN:|208-getter|2|
        return eliminarReglaCommand;
    }
    //</editor-fold>//GEN-END:|208-getter|2|
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc=" Generated Getter: editarReglaCommand ">//GEN-BEGIN:|210-getter|0|210-preInit
    /**
     * Returns an initiliazed instance of editarReglaCommand component.
     * @return the initialized component instance
     */
    public Command getEditarReglaCommand() {
        if (editarReglaCommand == null) {//GEN-END:|210-getter|0|210-preInit
            // write pre-init user code here
            editarReglaCommand = new Command("Editar", Command.ITEM, 0);//GEN-LINE:|210-getter|1|210-postInit
            // write post-init user code here
        }//GEN-BEGIN:|210-getter|2|
        return editarReglaCommand;
    }
    //</editor-fold>//GEN-END:|210-getter|2|

    public Hashtable getHashJuegos() {
        return juegos;
    }
    //</editor-fold>





    /**
     * Returns a display instance.
     * @return the display instance.
     */
    public Display getDisplay () {
        return Display.getDisplay(this);
    }

    /**
     * Exits MIDlet.
     */
    public void exitMIDlet() {
        switchDisplayable (null, null);
        destroyApp(true);
        notifyDestroyed();
    }

    /**
     * Called when MIDlet is started.
     * Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.
     */
    public void startApp() {
        if (midletPaused) {
            resumeMIDlet ();
        } else {
            initialize ();
            startMIDlet ();
        }
        midletPaused = false;
    }

    /**
     * Called when MIDlet is paused.
     */
    public void pauseApp() {
        midletPaused = true;
    }

    /**
     * Called to signal the MIDlet to terminate.
     * @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.
     */
    public void destroyApp(boolean unconditional) {
    }

}
